home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / ask.zip / ASK.DOC next >
Text File  |  1988-01-15  |  2KB  |  56 lines

  1. Ask is a batch enhancement program that allows you to prompt a user and read a
  2. response on the same line.  It then translates the user response into an
  3. ERRORLEVEL code that can be used to perform different functions in batch files.
  4.  
  5. Example:
  6.  
  7.    ECHO  Please enter one of the following:
  8.    ECHO.
  9.    ECHO  A.  Start word processor
  10.    ECHO  B.  Start spreadsheet
  11.    ECHO  C.  Start database
  12.    ECHO.
  13.    ask "Please enter A, B, or C -> " ABC
  14.    IF ERRORLEVEL 3 GOTO C
  15.    IF ERRORLEVEL 2 GOTO B
  16.    IF ERRORLEVEL 1 GOTO A
  17.  
  18.  
  19. Only characters in the response string (ABC in the example above) are
  20. recognized.  If the user tries to enter another character, Ask will beep
  21. and wait for a character in the list.
  22.  
  23. The characters in the response (ABC) above are not limited to letters.  Digits
  24. or special characters may be used.  Only a single character is recognized in a
  25. response.  Any of the 255 ASCII characters may be used, except that no
  26. distinction is made between uppercase and lowercase letters.  Function keys,
  27. arrow keys, Alt and Ctrl keys are not recognized.
  28.  
  29. ERRORLEVEL is set to the position of the user's response in the character
  30. string.  Thus, if the string is "ABC" and the user types "B", ERRORLEVEL will
  31. be set to 2.  But if the string is "BCA" and the user types "B", ERRORLEVEL
  32. will be set to 1.  (abc, ABC, B, b would all produce the same result in these
  33. examples.)
  34.  
  35. Remember in a batch file that the test
  36.    IF ERRORLEVEL n statement
  37. is interpreted as
  38.    IF ERRORLEVEL >= n statement
  39. so be sure that your IFs test the numbers in descending order.
  40.  
  41. Ask may be distributed freely without charge, except for a distribution fee
  42. not to exceed $5.  No part of its code may be modified.
  43.  
  44. Ask is Copyright (c) 1988 by Sid Gudes.
  45.  
  46.  
  47.  
  48. Ask was written by:
  49.  
  50.         Sid Gudes
  51.         Productivity Improvement Enterprises
  52.         Box 11121
  53.         Arlington, VA   22210-2121
  54.         703/528-1984
  55.  
  56.